<template>
  <div id="app" style="overflow: hidden;">
    <div class="" style="z-index: 102">
      <my-header title="登录" title-color="white" headerBg="black">
        <img slot="left" src="../../assets/back.png" style="margin-top: 0;width: 0.5rem;height: 0.5rem" @click="goback()">
      </my-header>
    </div>
    <div class="content">
      <div class="topImg">
        <img src="../../assets/Login_head@2x.png" alt="">
      </div>
      <group style="border-color: #ffffff;">
        <x-input placeholder="请输入账号" class="bannerInput" border="0" v-model:value="phoneNum" type="number">
          <img slot="label" src="../../assets/Login_phone.png">
        </x-input>
        <x-input placeholder="请输入密码" class="bannerInput" border="0" v-model:value="password" type="password">
          <img slot="label" src="../../assets/Login_password.png">
        </x-input>

      </group>
      <box gap="0.4rem 0.4rem" style="margin-top: 0.5rem">
        <x-button type="primary mini" style="height: 0.8rem; line-height: 0.8rem" @click.native="loginRequest">登录</x-button>
      </box>

    </div>
  </div>
</template>
<script>
  import header from 'common/vue/Header.vue'
  import {XInput, Group, XButton, Box, Toast} from 'vux'
  import API from '../../../config/api/API'

  var api = new API();
  export default {
    data() {
      return {
        dataList: [],
        phoneNum: '',
        password: ''
      }
    },
    components: {
      'my-header': header,
      Box,
      XInput,
      Group,
      XButton,
      Toast
    },
    created () {
      this.outputToken();
    },
    mounted () {

    },
    watch: {

    },
    methods: {
      outputToken() {
        console.log(window.localStorage['token']);
      },
      goback(){
        window.history.back()
      },
      loginRequest() {
        var that = this

//        that.$vux.toast.show({
//          text: 'Hello World',
//          onShow () {
//            console.log('Plugin: I\'m showing')
//          },
//          onHide () {
//            console.log('Plugin: I\'m hiding')
//            _this.show9 = false
//          }
//        })


        api.getList("fw/app/common/login",{
          "phone":that.phoneNum,
          "password":that.password,
          "appVersion":"1",
          "uType":"0",
          "lat":"0",
          "lng":"0"
        }).then(function (res) {
          console.log(res.data)
          window.localStorage.setItem("token",res.data.tokenContent)
          setTimeout(function () {
            window.history.back()
          },200)
        })
      }
    }
  }

</script>
<style lang="less" rel="stylesheet/less" scoped>
  @import '../../css/Login/Login.less';
  html,body{
    background-color: #f3f3f3!important;
  }
</style>
<style>
  #app {
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    color: #2c3e50;
    margin-top: 0px;
  }
</style>
